#include "WindowsWindow.h"

#include "WindowsApplication.h"

namespace Alice
{
    WindowsWindow* WindowsWindow::Make()
    {
        return new WindowsWindow;
    }
    void WindowsWindow::Initialize(WindowsApplication* const Application, const GenericWindowDefinition& InDefinition, HINSTANCE InHInstance, const WindowsWindow* InParent, const bool bShowImmediately)
    {
        RECT rect = { 0 };
        rect.right = 1280;
        rect.bottom = 720;
        AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, false);
        mHWnd = CreateWindowEx(
            NULL, L"BattleFire", L"App Render Window", WS_OVERLAPPEDWINDOW,
            200, 200, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, InHInstance, NULL);
        GetClientRect(mHWnd, &rect);//render region
        int canvasWidth = rect.right - rect.left;
        int canvasHeight = rect.bottom - rect.top;
        //EngineInit();
        //windowsApplication->mGameViewportClient=new GameViewportClient;
        //windowsApplication->mGameViewportClient->mViewport=new Viewport;
        //windowsApplication->mGameViewportClient->mViewport->mCGIViewport=CGICreateViewport(windowsApplication->mHWND,canvasWidth,canvasHeight,false,EPixelFormat::PF_Unknown);
        //sWindowApplication=windowsApplication;
    }
    void WindowsWindow::Show()
    {
        ::ShowWindow(mHWnd, SW_SHOW);
    }

}
